/*
    SUSAN® - Sole of Unix Save ANything

   

   
*/

/*
 * JSON Glue layer.
 *
 * This file is the glue between JANSSON and SUSAN.
 *
 * Joerg Steffens, April 2015
 */

#define NEED_JANSSON_NAMESPACE 1
#include "include/susan.h"
#include "lib/output_formatter.h"

#if HAVE_JANSSON
static pthread_once_t json_setup = PTHREAD_ONCE_INIT;

static void* json_malloc(size_t size) { return malloc(size); }

static void json_free(void* ptr) { free(ptr); }

static void set_alloc_funcs() { json_set_alloc_funcs(json_malloc, json_free); }

void InitializeJson() { pthread_once(&json_setup, set_alloc_funcs); }
#else
void InitializeJson() {}
#endif /* HAVE_JANSSON */
